module(
    name = "rules_img",
    version = "0.2.8",
    compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.11")

prebuilt_img_tool = use_extension("@rules_img//img/private/prebuilt:prebuilt.bzl", "prebuilt_img_tool")
prebuilt_img_tool.collection(
    name = "img_toolchain",
)
prebuilt_img_tool.from_file(
    collection = "img_toolchain",
    file = "@rules_img//:prebuilt_lockfile.json",
)
use_repo(
    prebuilt_img_tool,
    "img_toolchain",
)

# register a prebuilt toolchain of the img tool.
register_toolchains(
    "@img_toolchain//:all",
)

pull_tool = use_extension("@rules_img//img/private/prebuilt:prebuilt.bzl", "pull_tool")
pull_tool.collection(name = "pull_hub_repo")
pull_tool.from_file(
    collection = "pull_hub_repo",
    file = "@rules_img//:pull_tool_lockfile.json",
)
use_repo(
    pull_tool,
    "pull_hub_repo",
)

# ✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂
# only dev_dependencies below this line - rules_img is lean
# ✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂

# toolchains_protoc needs to be placed at the top to ensure the proto toolchain is registered first
bazel_dep(name = "toolchains_protoc", version = "0.6.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.21.2", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.8.2", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.45.0", dev_dependency = True)
bazel_dep(name = "hermetic_cc_toolchain", version = "4.0.1", dev_dependency = True)
bazel_dep(name = "rules_bazel_integration_test", version = "0.34.0", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.58.2", dev_dependency = True)
bazel_dep(name = "rules_img_pull_tool", version = "0.2.8", dev_dependency = True)
bazel_dep(name = "rules_img_tool", version = "0.2.8", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.1.0", dev_dependency = True)
bazel_dep(name = "rules_python", version = "1.6.3", dev_dependency = True)

# Register a source-built toolchain of the img tool
# for use in this repository (in dev mode).
register_toolchains(
    "@rules_img_tool//toolchain:all",
    dev_dependency = True,
)

module_version = use_extension("//img/private/config:defs.bzl", "module_version", dev_dependency = True)
use_repo(module_version, "rules_img_version")

bazel_binaries = use_extension(
    "@rules_bazel_integration_test//:extensions.bzl",
    "bazel_binaries",
    dev_dependency = True,
)
bazel_binaries.download(version = "7.4.0")
bazel_binaries.download(version = "8.4.2")
bazel_binaries.download(version = "9.0.0-pre.20251022.1")
use_repo(bazel_binaries, "bazel_binaries", "bazel_binaries_bazelisk", "build_bazel_bazel_7_4_0", "build_bazel_bazel_8_4_2", "build_bazel_bazel_9_0_0-pre_20251022_1")

go_sdk = use_extension(
    "@rules_go//go:extensions.bzl",
    "go_sdk",
    dev_dependency = True,
)
go_sdk.download(version = "1.24.2")
go_sdk.nogo(
    includes = [
        "@rules_img//:__subpackages__",
        "@rules_img_pull_tool//:__subpackages__",
        "@rules_img_tool//:__subpackages__",
    ],
    nogo = "//util:nogo",
)

toolchains = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains", dev_dependency = True)
use_repo(toolchains, "zig_sdk")

register_toolchains(
    "@zig_sdk//toolchain:linux_amd64_musl",
    "@zig_sdk//toolchain:linux_arm64_musl",
    dev_dependency = True,
)

http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

http_file(
    name = "large_file_1GB",
    dev_dependency = True,
    integrity = "sha256-n9ndX1LfKXTrcnPBT8Kqa85x87TcH3BOaHWoeuJ+kKA=",
    urls = ["https://ash-speed.hetzner.com/1GB.bin"],
)

http_file(
    name = "large_file_10GB",
    dev_dependency = True,
    integrity = "sha256-Vc5IJJOis3bBooauVUOr77JwiZLHC3lA9dbAjMZvNFw=",
    urls = ["https://ash-speed.hetzner.com/10GB.bin"],
)
